﻿using System;
using MuzoBlog.Core.BussinessLogic.Blog;
using MuzoBlog.Core;
using MuzoBlog.Core.BussinessLogic.Blog.Entities;
using System.Collections.Generic;
using Muzo.Core.Helpers;

public partial class Install_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (MuzoApp.Db != null)
            Response.Redirect("~/");
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string defaultConfigurationPath = Server.MapPath("~/Install/DefaultSettings.xml");

        List<Setting> defaultSettings = SerializationHelper.XmlDeSerialize<List<Setting>>(FileHelper.GetText(defaultConfigurationPath));

        BlogManager.Create("admin", "password", defaultSettings);
        Response.Redirect("~/");
    }
}